package com.atguigu;

import com.atguigu.pojo.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

/**
 * @ClassNAME MySpringBootApplication
 * @Description
 * @Author wuyafeng atguigu
 * @Date 2021/11/9 21:22
 * @Version 1.0
 **/
@SpringBootApplication
public class MySpringBootApplication {
    public static void main(String[] args) {
       ApplicationContext app =  SpringApplication.run(MySpringBootApplication.class,args);
        //系统自动帮我们配置了哪些对象
//       for(String beanName  : app.getBeanDefinitionNames()){
//           System.out.println("===>"+beanName);
//       }

       //2 源码分析SpringBootApplication
        /**
         * @ComponentScan  :以入口类未起点，进行扫包
         *     @Component:  扫描注解包括 @Controller @Service @Repository
         *     @Scan ：  扫描
         * @SpringBootConfiguration： 表示当前类是一个配置类
         *    @Configuration： 等价与这个注解
         * @EnableAutoConfiguration ：  自动配置
         * @Import(Class = AutoConfigurationImportSelector)
         *
         */

        //获取用户信息
       User user =  (User)app.getBean(User.class);
        System.out.println(user);
    }

}
